// **************************************************************
// Com ++ Framework by the C++ World
// Please report defects: mailto:compp@cplusplusworld.com
// Please visit: http://www.cplusplusworld.com/socketlibrary.html
// **************************************************************

#include <iostream>
#include <cstdlib>
#include <string>
#include "ComPlusPlus/ComPlusPlus"
 
int main (int argc, char *argv [] ) {

  if ( argc != 3 ) {
    std::cout << "Usage " << argv[0] << " port host \n";
    return 1;
  } 
  int port =  std::atoi(argv [1]);
  std::string Host = argv [2];
 
	
try {
 compp::SocketUdp Client;	

 // -> Comment 2
 Client.SetSockOptBroadcast(true);
 // -> Comment 3
 // -> Comment 4
 std::string s = "Broadcasting with Sendto!\n";
 Client.Sendto(s.c_str(), s.length(), Host.c_str()  , port);
 Client.Close(); 
} catch ( syspp::ComException e ) {
	std::cout <<  "Exception " << e.what() << "\n" ;	
}
 return 0;	
}
